package cn.stazxr.component;

import javax.swing.*;
import java.awt.*;
import java.util.Date;

/**
 * Package: cn.stazxr.component
 * ButtonTest
 * @Author: stazxr
 * @Create: 2023/12/2
 * @Version: v1.0
 **/
public class ButtonTest {
    public static void main(String[] args) {
        Frame frame = new Frame("Hello world!");
        frame.setBounds(500, 300, 500, 300);
        frame.setFont(new Font("Microsoft YaHei UI",Font.ITALIC,15));
        frame.setLayout(null);

        JButton button = new JButton("点击充值");
        button.setBounds(20, 50, 100, 50);
        frame.add(button);
        button.addActionListener(e -> System.out.println(new Date(e.getWhen()) + "充值成功"));//addActionListener就是按钮点击监听器
        frame.setVisible(true);
    }
}
